/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:张熳
 * Date:2025-08-29
 * Time:4:33
 */
//内部类
//静态内部类
public class OutClass {
    //成员变量
    public int date1 = 1;
    public int date2 = 2;
    //静态成员变量
    public static int date3 = 3;
    //成员方法
    public void testA() {
        System.out.println("testA()");
        InnerClass innerClass = new InnerClass();
    }
    //静态成员方法
    public static void testB() {
        System.out.println("static-OutClass{}中的testB()");
    }

    //静态内部类
    static class InnerClass {
        public int date4 = 4;
        public int date5 = 5;
        public static int date6 = 6;
        public void test() {
            System.out.println("static-InnerClass{}中test()");
            //外部类静态成员直接访问
            System.out.println(date3);
            testB();
            //外部类非静态成员先实例化对象，通过对象的引用去访问
            OutClass outClass = new OutClass();
            System.out.println(outClass.date1);
            outClass.testA();
            InnerClass innerClass = new InnerClass();
        }
    }
}
